package day4.zy6;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;

public class CX {

    public void copyFile(String fileName1,String fileName2){
//复制文件

        try {
            byte[] bt=new byte[1024];

            InputStream is=new FileInputStream(fileName1);

            OutputStream os=new FileOutputStream(fileName2);

            int len=0;

            while((len=(is.read(bt)))!=-1){
                os.write(bt,0,len);

                os.flush();

            }

            is.close();

            os.close();

        } catch (Exception e) {
// TODO: handle exception

        }



    }

}
